--获取展览票的id
local exhibitionTicketId = ARGV[1]
--获取用户id
local userIdentityId = ARGV[2]
--拼接键
local ticket = "exhibition:ticket:" .. exhibitionTicketId
local order = "exhibition:order:" .. exhibitionTicketId
--判断当前时间段库存是否充足
if(tonumber(redis.call("GET", ticket)) <=0) then
	return 1;
end
--判断用户是否预约过
if(redis.call("sismember", order, userIdentityId) == 1) then
	return 2;
end
--扣减库存，添加订单
redis.call("incrby", ticket, -1)
redis.call("sadd", order, userIdentityId)
return 0;